home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung 2 / Power-Programmierung CD 2 (Tewi)(1994).iso / c / library / dos / tvision / tfield / tfield.doc < prev    next >
Encoding:
Text File  |  1992-03-25  |  52.5 KB  |  1,218 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.             TDate                                                         TFIELD.H tdate.cpp
  10.             --------------------------------------------------------------------------------
  11.                 _________
  12.                 | TDate |
  13.                 ---------
  14.  
  15.             *** NOTE ***
  16.             This class is derived from the DATECL.ZIP file found in the C++ section (lib 6)
  17.             of the BPROGB forum on compuserve.  I have just added the setDate functions and
  18.             the coversion to PXDate functions.  The rest of the class hasn't changed (much,
  19.             if at all).  I haven't found any problems with it, but I haven't attempted to
  20.             verify all the algorithm's, either!
  21.             ************
  22.  
  23.                           Data
  24.                        Members
  25.  
  26.                    day_of_week   int day_of_week                                   PROTECTED
  27.  
  28.                                  Holds the current day of the week: Sunday = 1 ... Saturday
  29.                                  = 7, or 0 if an invalid date is specified.
  30.  
  31.                  displayFormat   static int displayFormat                            PRIVATE
  32.  
  33.                                  Specifies the format used to display the date.  Current
  34.                                  enumerated values for displayFormat are MDY, FULL or
  35.                                  EUROPEAN.  The values DAY and MONTH are also provided, but
  36.                                  are not supported by the setDate string parser.
  37.  
  38.                                  See Also: TDate::setFormat
  39.  
  40.                 displayOptions   static unsigned char displayOptions                 PRIVATE
  41.  
  42.                                  Specifies options which modify the format used to display
  43.                                  the date.  Current options are NO_CENTURY -- Suppress the
  44.                                  printing of the century when in the MDY format (ex:
  45.                                  01/01/91 instead of 01/01/1991).  DATE_ABBR -- Abbreviate
  46.                                  month and day names when printing in the MONTH, DAY, FULL
  47.                                  or EUROPEAN formats. (ex. MON, TUE, JAN, FEB, etc.) The
  48.                                  length or the abbreviation is controlled by a DEFINED
  49.                                  constant in TFIELD.H named ABBR_LENGTH, preset to 3.
  50.  
  51.                                  See Also: TDate::setOption
  52.  
  53.                         julian   unsigned long julian                              PROTECTED
  54.  
  55.                                  Holds the count of the number of days that have passed
  56.                                  since 1/1/4713 B.C.
  57.  
  58.                      tdate_day   int tdate_day                                     PROTECTED
  59.  
  60.                                  Holds the current day of the month, or 0 if an invalid date
  61.                                  is specified.
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.                    tdate_month   int tdate_month                                   PROTECTED
  70.  
  71.                                  Holds the current month, or 0 if an invalid date is
  72.                                  specified.
  73.  
  74.                     tdate_year   int tdate_year                                    PROTECTED
  75.  
  76.                                  Holds the current year, or 0 if an invalid day is
  77.                                  specified.
  78.  
  79.                         Member
  80.                      Functions
  81.  
  82.                   constructors   TDate ();
  83.  
  84.                                  Initializes displayFormat to MDY.  Initializes day,
  85.                                  day_of_week, displayOptions, julian, month and year to 0.
  86.  
  87.                                  TDate (const long aJulDate, const long offset = 0);
  88.  
  89.                                  Initializes displayFormat to MDY and displayOptions to 0. 
  90.                                  Sets julian to aJulDate + offset.  PXOffset is the only
  91.                                  offset currently support.  This allows a TDate to be
  92.                                  initialized by calling TDate( PXDate, PXOffset ). 
  93.                                  Initializes day, day_of_week, month and year to coincide to
  94.                                  the julian date.
  95.  
  96.                                  TDate (const int m, const int d, const int y);
  97.  
  98.                                  Initializes displayFormat to MDY and displayOptions to 0. 
  99.                                  Sets the initial day, month and year from the values
  100.                                  provides.  Computes julian for the specified date and
  101.                                  computes the day_of_week for the date.
  102.  
  103.                                  TDate (char *dat);
  104.  
  105.                                  Initializes displayFormat to MDY and displayOptions to 0. 
  106.                                  Calls setDate to attempt to parse the dat.  If successful,
  107.                                  day, day_of_week, julian, month and year are all
  108.                                  initialized to the specified date.
  109.  
  110.                                  TDate (const date &ds);
  111.  
  112.                                  Initializes displayFormat to MDY and displayOptions to 0. 
  113.                                  Copies the day, month and year from the DOS date structure
  114.                                  and sets julian and day_of_week for the specified date.
  115.  
  116.                                  TDate (const TDate &dt);
  117.  
  118.                                  Copies the day, displayFormat, displayOptions, month and
  119.                                  year from the specified TDate.  Calculates the julian and
  120.                                  day_of_week for the specified date.
  121.  
  122.                  char_to_month   int char_to_month( const char *charMonth);          PRIVATE
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.                                  Converts month name to month value.  Only the first two or
  131.                                  three characters of the charMonth are checked for a match. 
  132.                                  Matching values are JA FE MAR AP MAY JUN JUL AU SE OC NO
  133.                                  DE.  If the value doesn't match, a 0 is returned.
  134.  
  135.                            day   int day(void) const;
  136.  
  137.                                  Returns the value of the day for the date.
  138.  
  139.                      dayOfYear   int dayOfYear(void) const;
  140.  
  141.                                  Returns relative date since Jan. 1
  142.  
  143.                      decrMonth   void decrMonth(void);
  144.  
  145.                                  Decrements the month by 1.  Adjusts the year and day if
  146.                                  necessary.
  147.  
  148.                       decrYear   void decrYear(void);
  149.  
  150.                                  Decrements the year by 1.  Adjusts the day if necessary.
  151.  
  152.                            dow   int dow(void) const;
  153.  
  154.                                  Returns the value of the day_of_week for the date.
  155.  
  156.                            eom   date eom(void) const;
  157.  
  158.                                  Returns last day of month in object.  ***NOTE*** This
  159.                                  function returns a date not a TDate!!!
  160.  
  161.                     formatDate   char *formatDate (int type=-1) const;
  162.  
  163.                                  Return a string value for the current date in the specified
  164.                                  format.  If type = -1, the format specified in
  165.                                  displayFormat will be used.  Other valid types are MDY,
  166.                                  FULL and EUROPEAN.  Types MONTH and DAY are valid but not
  167.                                  be used to generate a new date from the returned string, as
  168.                                  insufficient information is present for the setDate( char
  169.                                  *) parser.
  170.  
  171.                                  **** NOTE ****
  172.                                  This function returns a newStr'd string pointer.  Storage
  173.                                  has been allocated for this string from the heap.  To avoid
  174.                                  memory leaks, make sure to delete the string after you're
  175.                                  done using it!
  176.  
  177.                        getDate   date getDate(void) const;
  178.  
  179.                                  Returns a date structure.  ***NOTE*** This function returns
  180.                                  a date not a TDate!!!
  181.  
  182.                      incrMonth   void incrMonth(void);
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.                                  Increments the month by 1.  Adjusts the year and day if
  191.                                  necessary.
  192.  
  193.                       incrYear   void incrYear(void);
  194.  
  195.                                  Increments the year by 1.  Adjusts the day if necessary.
  196.  
  197.                     isLeapYear   int isLeapYear(void) const;
  198.  
  199.                                  Returns 1 if leap year, 0 if not
  200.  
  201.                        julDate   long julDate(void) const;
  202.  
  203.                                  Returns julian date.
  204.  
  205.                  julian_to_mdy   void julian_to_mdy (void);                          PRIVATE
  206.  
  207.                                  convert julian day to mdy
  208.  
  209.                 julian_to_wday   void julian_to_wday (void);                         PRIVATE
  210.  
  211.                                  convert julian day to day_of_week
  212.  
  213.                  mdy_to_julian   void mdy_to_julian (void);                          PRIVATE
  214.  
  215.                                  convert mdy to julian day
  216.  
  217.                          month   int month(void) const;
  218.  
  219.                                  Returns the value of the month for the date.
  220.  
  221.                      operators
  222.  
  223.                              +   TDate operator +  (const long i);
  224.  
  225.                                  Returns the value date + i days.
  226.  
  227.                               -  TDate operator -  (const long i);
  228.  
  229.                                  Returns the value of date - i days.
  230.  
  231.                              -   long  operator -  (const TDate &dt);
  232.  
  233.                                  Returns the number of days between two dates.
  234.  
  235.                             +=   TDate &operator += (const long i);
  236.  
  237.                                  Adds i days to the date.
  238.  
  239.                             -=   TDate &operator -= (const long i);
  240.  
  241.                                  Subtracts i days from the date.
  242.  
  243.                             ++   TDate &operator ++ (void);
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.                                  pre increment function
  252.  
  253.                             ++   TDate &operator ++ (int); 
  254.  
  255.                                  post increment function
  256.  
  257.                             --   TDate &operator -- (void); 
  258.  
  259.                                  pre decrement function
  260.  
  261.                             --   TDate &operator -- (int);
  262.  
  263.                                  post decrement function
  264.  
  265.                              <   friend int operator <  (const TDate &dt1, const TDate
  266.                                  &dt2);
  267.  
  268.                                  Returns 1 if dt1 is less than dt2, returns 0 otherwise.
  269.  
  270.                             <=   friend int operator <= (const TDate &dt1, const TDate
  271.                                  &dt2);
  272.  
  273.                                  Returns 1 if dt1 is less than or equal to dt2, returns 0
  274.                                  otherwise.
  275.  
  276.                              >   friend int operator >  (const TDate &dt1, const TDate
  277.                                  &dt2);
  278.  
  279.                                  Returns 1 is dt1 is greater than dt2, returns 0 otherwise.
  280.  
  281.                             >=   friend int operator >= (const TDate &dt1, const TDate
  282.                                  &dt2);
  283.  
  284.                                  Returns 1 if dt1 is greater that or equal to dt2, returns 0
  285.                                  otherwise.
  286.  
  287.                             ==   friend int operator == (const TDate &dt1, const TDate
  288.                                  &dt2);
  289.  
  290.                                  Returns 1 if dt1 is equal to dt2, returns 0 otherwise.
  291.  
  292.                             !=   friend int operator != (const TDate &dt1, const TDate
  293.                                  &dt2);
  294.  
  295.                                  Returns 1 if dt1 is not equal to dt2, returns 0 otherwise.
  296.  
  297.                             <<   friend ostream &operator << (ostream &os, const TDate &dt);
  298.  
  299.                                  Places the character date on the output stream in the
  300.                                  format MM/DD/YY.
  301.  
  302.  
  303.  
  304.  
  305.  
  306.  
  307.  
  308.                             <<   friend ostream &operator << (ostream &os, const date &dt);
  309.  
  310.                                  Places the character date on the output stream in the
  311.                                  format MM/DD/YY.
  312.  
  313.                         PXDate   long PXDate(void) const;
  314.  
  315.                                  Returns date in paradox format (i.e. julian - PXOffset )
  316.  
  317.                        setDate   int setDate (const char *charDate); 
  318.  
  319.                                  setDate will attempt to translate the charDate into a valid
  320.                                  date format.  charDate is first parsed into seperate tokens
  321.                                  by calling TParser::parse.  The tokens are then scanned to
  322.                                  see if a valid character month has been specified (JA FE
  323.                                  MAR AP MAY JUN JUL AU SE OC NO DE).  The tokens are then
  324.                                  rescanned to interpret any numbers into month, day and year
  325.                                  values in that order.  If a day is not specified, the first
  326.                                  will be assumed.  If a year is not specified the current
  327.                                  year is assumed.  The strings "TODAY" or "*" will return
  328.                                  the current computer date.  Returns 1 if successful, 0 if
  329.                                  not.  (Parsing does not always return the desired date.  If
  330.                                  anyone has suggestions for ways to improve this process,
  331.                                  please let me know.  This was the best I could come up
  332.                                  with.  MBB)
  333.  
  334.                        setDate   int setDate (const long aJulDate, const long offset = 0 );
  335.  
  336.                                  Set the date to the value specified in aJulDate + offset. 
  337.                                  PXOffset is the only offset which is currently defined.  To
  338.                                  set the date from a date in paradox format, call setDate(
  339.                                  PXDate, PXOffset ).  Returns 1 if successful, 0 if not.
  340.  
  341.                      setFormat   static void setFormat (const int format);
  342.  
  343.                                  Specify the default format to be used in displaying the
  344.                                  date.  Possible values are MDY, FULL, EUROPEAN.  To other
  345.                                  values are provided, DAY and MONTH, but are not supported
  346.                                  by the setDate( char *) parser.
  347.  
  348.                      setOption   static int setOption (const int option, const int
  349.                                     action=ON);
  350.  
  351.                                  Specify the display options to be used in displaying the
  352.                                  date.  Possible values are NO_CENTURY and DATE_ABBR. 
  353.                                  Action can be ON or OFF to enable or disable the option.
  354.  
  355.                           year   int year(void) const;
  356.  
  357.                                  Returns the value of the year for the date.
  358.  
  359.  
  360.  
  361.  
  362.  
  363.  
  364.  
  365.             TDateField                                                  TFIELD.H tdfield.cpp
  366.             --------------------------------------------------------------------------------
  367.                 __________
  368.                 | TField |
  369.                 ----------
  370.                     I
  371.               ______I_______
  372.               | TDateField |
  373.               --------------
  374.  
  375.             TDateField provides the means for manipulating dates in dialogs and windows. 
  376.             Upon entering a TDateField, the current data string is selected.  While the data
  377.             string is completely selected, the + key will increment the date one day, the -
  378.             key will decrement the date one day, the <PageDown> key will increment the
  379.             date's month by 1 and the <PageUp> key will decrement the date's month by 1,
  380.             unless the minimum or maximum date boundaries would be crossed (if enabled.)
  381.  
  382.                           Data
  383.                        Members
  384.  
  385.                       maxValue   TDate maxValue
  386.  
  387.                                  Maximum allowable date if tfValidateMax is enabled.
  388.  
  389.                       minValue   TDate minValue
  390.  
  391.                                  Minimum allowable date if tfValidateMin is enabled.
  392.  
  393.                          value   TDate value
  394.  
  395.                                  Current date value for this field.
  396.  
  397.                         Member
  398.                      functions
  399.  
  400.                    constructor   TDateField( const TRect& bounds, int aMaxLen );
  401.  
  402.  
  403.  
  404.                    convertData   virtual void convertData( void );
  405.  
  406.                                  Attempts to convert the char string data to a date by
  407.                                  calling value.setDate( data ).  If successful, data is
  408.                                  updated to the current displayFormat for the date and the
  409.                                  window is redrawn.
  410.  
  411.                       dataSize   virtual ushort dataSize();
  412.  
  413.                                  Returns the size of the date storage in memory
  414.                                  (sizeof(long)) in the current implementation.
  415.  
  416.                 filterCharCode   virtual ushort filterCharCode( ushort charCode );
  417.  
  418.  
  419.  
  420.  
  421.  
  422.  
  423.  
  424.                        getData   virtual void getData( void *rec );
  425.  
  426.  
  427.  
  428.                        isValid   virtual Boolean isValid( ushort command );
  429.  
  430.  
  431.  
  432.                 processKeyCode   virtual ushort processKeyCode( ushort keyCode );
  433.  
  434.  
  435.  
  436.                        setData   virtual void setData( void *rec );
  437.  
  438.  
  439.  
  440.                      setJulian   void setJulian( long julDate );
  441.  
  442.                                  Set the date value from a julian date (1/1/4713 BC offset)
  443.  
  444.                         setMax   virtual void setMax( TDate newMax );
  445.  
  446.                                  Set the maxValue to newMax and enable the tfValidateMax
  447.                                  option.
  448.  
  449.                         setMin   virtual void setMin( TDate newMin );
  450.  
  451.                                  Set the minValue to newMin and enable the tfValidateMin
  452.                                  option.
  453.  
  454.                     setParadox   void setParadox( long pxDate );
  455.  
  456.                                  Set the date value from a date in Paradox format. (1/1/1 AD
  457.                                  offset)
  458.  
  459.  
  460.  
  461.  
  462.  
  463.  
  464.  
  465.             TField                                                       TFIELD.H tfield.cpp
  466.             --------------------------------------------------------------------------------
  467.                 _________
  468.                 | TView |
  469.                 ---------
  470.                     I
  471.                 ____I_____
  472.                 | TField |
  473.                 ----------
  474.  
  475.             A TField object provides a basic input line string editor. It handles keyboard
  476.             input and mouse clicks and drags for block marking and a variety of line editing
  477.             functions (see TField handleEvent). The selected text is deleted and then
  478.             replaced by the first text input. 
  479.  
  480.             The tfOptions data member controls various options based on which bits are set. 
  481.             The current tfOptions supported are:
  482.  
  483.                     tfRight --   the field is right justified when this bit is set
  484.                  tfNoScroll --   scrolling is disabled when this bit
  485.                tfHideSecure --   masks out the data with securityChar if this bit is set and
  486.                                  the field's fieldSecurity < currentSecurity
  487.                  tfMustFill --   displays an error message when leaving the field if the
  488.                                  field does not contain aMaxLen - 1 characters.  Also
  489.                                  returns a False from the valid routine so the
  490.                                  TDialog/TWindow will not be able to close.
  491.                  tfNotEmpty --   checks that the field contains at least 1 character when
  492.                                  leaving the field, if it doesn't an error message is
  493.                                  displayed and valid returns False.  The error message from
  494.                                  tfMustFill overrides this error message if tfMustFill is
  495.                                  enabled.
  496.                 tfBeepError --   controls whether a beep sounds on data entry errors. 
  497.                                  Enable tfBeepError to get a beep.
  498.                 tfEnterTabs --   controls whether the enter key should move the cursor to
  499.                                  the next field or not.  Enable tfEnterTabs for the enter
  500.                                  key to advance the focus to the next field.
  501.                 tfStayError --   controls whether the field will lose the focus when it
  502.                                  contains invalid data (or doesn't meet the requirements of
  503.                                  tfMustFill or tfNotEmpty.)  If this bit is enabled, the
  504.                                  keyboard control keys (tab/shiftTab/enter) will not allow
  505.                                  the focus to leave the field while it contains invalid
  506.                                  data.  ***NOTE*** this version DOES NOT stop mouse events
  507.                                  from causing the field to lose its focus.  The lostFocus
  508.                                  routine will still be called for mouse events, but the way
  509.                                  the current TView::Select function operates precludes
  510.                                  trapping all events unless the TView source is modified
  511.                                  (requested of Borland, but beyond the scope of the design
  512.                                  specifications for this class.)
  513.                tfPreValidate--   controls whether the isValid function is called before or
  514.                                  after the "standard" validations are performed.  By
  515.                                  default, isValid will be called after the length (and
  516.                                  min/max in derived classes) validations have occurred
  517.                                  successfully.  Setting this flag forces the isValid
  518.                                  function to be called before the other validations have
  519.  
  520.  
  521.  
  522.  
  523.  
  524.  
  525.  
  526.                                  occurred.
  527.  
  528.             The status of these bits may be directly changed by the programmer, but using
  529.             the setTFOptions member function insures that all views are appropriately
  530.             redrawn as required by the changes to tfOptions.
  531.  
  532.             The following tfOption flags are reserved for future use in derived classes:
  533.  
  534.                  tfValidateMin
  535.                  tfValidateMax
  536.                        tfPopUp
  537.  
  538.             Field security is controlled by two member variables:  fieldSecurity (the
  539.             security level for this field) and currentSecurity (the applications current
  540.             authorized security level.)  The cmUpdateSecurity broadcast message can be used
  541.             to update the currentSecurity level of any fields derived from TField (not
  542.             completely functional at rev 1.0.1).  Alternatively, the setCurrentSecurity
  543.             member function can be called to update individual field's currentSecurity
  544.             levels.
  545.  
  546.             Two character fields (and a tfOptions flag) control the security of displayed
  547.             data.  hideChar will always replace the displayed data with strlen(data) copies
  548.             of itself (ie. if data = "hello" and hideChar = '*' then "*****" will be
  549.             displayed) when hideChar > ' '.  securityChar contains the character that will
  550.             replace the displayed data only if tfHideSecure is enabled and fieldSecurity <
  551.             currentSecurity.  This allows for dynamic control of what fields will display
  552.             data based on a user's security level.
  553.  
  554.             The getData and setData member functions are available for writing and reading
  555.             data strings (referenced via the data string data member) into the given record.
  556.             TField::setState simplifies the redrawing of the view with appropriate colors
  557.             when the state changes from or to sfActive and sfSelected.
  558.  
  559.             Field validation can be accomplished using a combination of virtual functions. 
  560.             filterCharCode can be used to filter out unacceptable characters for a field. 
  561.             convertData can be used for custom data conversion from string data values to
  562.             other internal types.  convertData is called before any valid ation is
  563.             performed.  isValid is called from the valid routine an may be used to perform
  564.             special validations tasks (eg. table lookups, etc.) either before or after the
  565.             standard validations have been performed for the field.  Finally the gotFocus
  566.             and lostFocus routines can be used to perform various tasks upon
  567.             entering/leaving the field.
  568.  
  569.  
  570.                           Data
  571.                        members
  572.                                                                                             
  573.                         curPos   int curPos;
  574.  
  575.                                  Index to insertion point (that is, to the current cursor
  576.                                  position).
  577.  
  578.                                  See also: TField::selectAll
  579.  
  580.  
  581.  
  582.  
  583.  
  584.  
  585.  
  586.                currentSecurity   ushort currentSecurity;
  587.  
  588.                                  Holds the current security level for the form (or program
  589.                                  or user, etc.)  This field is used in conjunction with
  590.                                  tfHideSecure option to determine if secure data should be
  591.                                  masked or not.
  592.  
  593.                                  See also:  TField::fieldSecurity, TField::securityChar,
  594.                                  TField::setCurrentSecurity, cmUpdateSecurity
  595.  
  596.                           data   char *data; 
  597.  
  598.                                  The string containing the edited information.
  599.  
  600.                      fieldHint   char *fieldHint;
  601.  
  602.                                  Pointer to the hint text for this field.  (Not used in this
  603.                                  implementation.  In the future though...)
  604.  
  605.                                  See also: TField::setHint
  606.  
  607.                      fieldName   char *fieldName;
  608.  
  609.                                  Pointer to the name text for this field.
  610.  
  611.                                  See also: TField::setName
  612.  
  613.                  fieldSecurity   ushort fieldSecurity;
  614.  
  615.                                  Holds the security level for the current field.  If the
  616.                                  tfHideSecure option is enabled, then the data for the field
  617.                                  is masked if fieldSecurity < currentSecurity.
  618.  
  619.                                  See also: TField::currentSecurity, TField::SecurityChar,
  620.                                  tfHideSecure
  621.  
  622.                       firstPos   int firstPos;
  623.  
  624.                                  Index to the first displayed character.
  625.  
  626.                                  See also: TField::selectAll
  627.  
  628.                       hideChar   char hideChar;
  629.  
  630.                                  Character to use to hide the field's display.  If hideChar
  631.                                  < ' ' (space) then the field's data is displayed, if
  632.                                  hideChar >= ' ' then the field's data is masked by the
  633.                                  hideChar.
  634.  
  635.  
  636.  
  637.  
  638.  
  639.  
  640.  
  641.                         maxLen   int maxLen;
  642.  
  643.                                  Maximum length allowed for string to grow (excluding the
  644.                                  final 0).  This value is initialized to aMaxLen - 1 in the
  645.                                  TField constructor.
  646.  
  647.                                  See also: TField::dataSize
  648.  
  649.                   securityChar   char securityChar;
  650.  
  651.                                  Holds the character to be used as a mask if tfHideSecure is
  652.                                  enables and fieldSecurity < currentSecurity.
  653.  
  654.                                  See also: TField::fieldSecurity, TField::currentSecurity,
  655.                                  TField::tfOptions, tfHideSecure
  656.  
  657.                         selEnd   int selEnd;
  658.  
  659.                                  Index to the end of the selection area (that is, to the
  660.                                  last character block marked).
  661.  
  662.                                  See also: TField::selectAll
  663.  
  664.                       selStart   int selStart;
  665.  
  666.                                  Index to the beginning of the selection area (that is, to
  667.                                  the first character block marked). 
  668.  
  669.                                  See also: TField::selectAll
  670.  
  671.                      tfOptions   ushort tfOptions;
  672.  
  673.                                  Bitmapped flag field for various field control states.
  674.  
  675.                                  See also: tfRight, tfNoScroll, tfHideSecure, tfValidateMax,
  676.                                  tfValidateMin, tfMustFill, tfNotEmpty, tfBeepError,
  677.                                  tfEnterTabs, tfStayError, tfPopUp, tfPreValidate and
  678.                                  TField::setTFOptions
  679.  
  680.  
  681.  
  682.  
  683.  
  684.  
  685.  
  686.                         Member
  687.                      functions
  688.  
  689.                    constructor   TField(const TRect& bounds, int aMaxLen);
  690.  
  691.                                  Creates an input box control with the given values by
  692.                                  calling TView(bounds). state is then set to sfCursorVis,
  693.                                  options is set to (ofSelectable | ofFirstClick), and maxLen
  694.                                  is set to aMaxLen - 1. Memory is allocated and cleared for
  695.                                  aMaxlen bytes and the data data member set to point at this
  696.                                  allocation.
  697.  
  698.                                  **** NOTE ****
  699.                                  Be sure to note that aMaxLen includes the terminating \0
  700.                                  character.  For a TField which allows the user to type in
  701.                                  10 characters, use an aMaxLen of 11.
  702.  
  703.                    constructor   TField( StreamableInit streamableInit);           protected
  704.  
  705.                                  Each streamable class needs a "builder" to allocate the
  706.                                  correct memory for its objects together with the
  707.                                  initialized vtable pointers. This is achieved by calling
  708.                                  this constructor with an argument of type StreamableInit.
  709.                                  Refer also to Chapter 8. 
  710.  
  711.                                  See also: TView::TView, sfCursorVis, ofSelectable,
  712.                                  ofFirstClick
  713.  
  714.                     destructor   ~TField();
  715.  
  716.                                  Deletes the data, fieldHint and fieldName memory
  717.                                  allocation, then calls ~TView to destroy the TField object.
  718.  
  719.                                  See also: ~TView
  720.  
  721.                          build   static TStreamable *build();
  722.  
  723.                                  Called to create an object in certain stream-reading
  724.                                  situations.
  725.  
  726.                                  See also: TStreamableClass, ipstream::readData
  727.  
  728.                    convertData   virtual void convertData( void );
  729.  
  730.                                  Called from the valid routine to convert from character
  731.                                  data to specialized data types (eg. TDate, long, etc.) in
  732.                                  derived classes.
  733.  
  734.                                  See alse:  TField::valid
  735.  
  736.  
  737.  
  738.  
  739.  
  740.  
  741.  
  742.                       dataSize   virtual ushort dataSize ();
  743.  
  744.                                  Returns the size of the record for TField::getData and
  745.                                  TField:: setData calls. By default, it returns maxLen + 1.
  746.                                  Override this member function if you define descendants to
  747.                                  handle other data types. 
  748.  
  749.                                  See also: TField::getData, TField::setData 
  750.  
  751.                           draw   virtual void draw();
  752.  
  753.                                  Draws the input box and its data. The box is drawn with the
  754.                                  appropriate colors depending on whether the box is
  755.                                  sfFocused (that is, whether the box view owns the cursor),
  756.                                  and arrows are drawn if the input string exceeds the size
  757.                                  of the view (in either or both directions). Any selected
  758.                                  (blockmarked) characters are drawn with the appropriate
  759.                                  palette.
  760.  
  761.                 filterCharCode   virtual ushort filterCharCode( ushort charCode)
  762.  
  763.                                  Used to limit what characters can be input into a field. 
  764.                                  Default allow all characters in.  If the charCode should
  765.                                  not be allowed, a value of 0 should be returned.  If a
  766.                                  value of 1 is returned, the equivalent of a selectAll(true)
  767.                                  will be performed.  Values >= ' ' will be added to or
  768.                                  overwrite the data item.
  769.  
  770.                        getData   vlrtual void getData (void *rec);
  771.  
  772.                                  Writes the number of bytes (obtained from a call to
  773.                                  dataSize) from the data string to the array given by rec.
  774.                                  Used with setData for a variety of applications; for
  775.                                  example, temporary storage, or passing on the input string
  776.                                  to other views. Override getData if you define TField
  777.                                  descendants to handle non-string data types. You can also
  778.                                  use getData to convert from a string to other data types
  779.                                  after editing by TField. 
  780.  
  781.                                  See also: TField::dataSize, TField::setData
  782.  
  783.                     getPalette   virtual TPalette& getPalette() const;
  784.  
  785.                                  Returns the default palette string, cplnputLine,
  786.                                  "\x13\x13\x14\x15".
  787.  
  788.                       gotFocus   virtual void gotFocus( void );
  789.  
  790.                                  Called when the field receives the cmReceivedFocus message
  791.                                  (usually when the field receives the focus).
  792.  
  793.  
  794.  
  795.  
  796.  
  797.  
  798.  
  799.                    handleEvent   void handleEvent(TEvent& event);
  800.  
  801.                                  Calls TView::handleEvent, then handles all mouse and
  802.                                  keyboard events if the input box is selected. This member
  803.                                  function implements the standard editing capability of the
  804.                                  input box.
  805.  
  806.                                  Editing features include: block marking with mouse click
  807.                                  and drag; block deletion; insert or overwrite control with
  808.                                  automatic cursor shape change; automatic and manual
  809.                                  scrolling as required (depending on relative sizes of the
  810.                                  data string and size.x); manual horizontal scrolling via
  811.                                  mouse clicks on the arrow icons; manual cursor movement by
  812.                                  arrow, Home, and End keys (and their standard control-key
  813.                                  equivalents); character and block deletion with Del and
  814.                                  Ctrl-G. The view is redrawn as required and the TField data
  815.                                  members are adjusted appropriately. 
  816.  
  817.                                  See also: sfCursorlns, TView::handleEvent,
  818.                                  TField::selectAll
  819.  
  820.                        isValid   virtual Boolean isValid( ushort command);
  821.  
  822.                                  Called by the valid function.  If False is returned to
  823.                                  valid, valid will always fail.  If command = cmArriving,
  824.                                  validation should be performed based on the field being
  825.                                  entered (ie. is the field dependent on other
  826.                                  events/values).  If command = cmLeaving, validation should
  827.                                  be performed based on the field being left.
  828.  
  829.                      lostFocus   virtual void lostFocus( void );
  830.  
  831.                                  Called when the field receives the cmReleasedFocus message
  832.                                  (usually when the field is losing focus.)
  833.  
  834.                 processKeyCode   virtual ushort processKeyCode( ushort keyCode );
  835.  
  836.                                  This routine is called if the default handle event didn't
  837.                                  deal with the keyCode.  It allows users to easily process
  838.                                  non-default kbxxxx codes in derived classes without
  839.                                  overriding the handle event routine.
  840.  
  841.                                  See also: TField::handleEvent, TField::filterCharCode
  842.  
  843.                           read   virtual void *read( ipstream& is);
  844.  
  845.                                  Reads from the input stream is.
  846.  
  847.                                  See also: TStreamableClass, TStreamable, ipstream 
  848.  
  849.  
  850.  
  851.  
  852.  
  853.  
  854.  
  855.                      selectAll   void selectAll (Boolean enable);
  856.  
  857.                                  Sets curPos, firstPos, and selStart to 0. If enable is set
  858.                                  to True, selEnd is set to the length of the data string,
  859.                                  thereby selecting the whole input line; if enable is set to
  860.                                  False, selEnd is set to 0, thereby deselecting the whole
  861.                                  line. Finally, the view is redrawn by calling drawView.
  862.  
  863.                                  See also: TView::drawView
  864.  
  865.             setCurrentSecurity   virtual void setCurrentSecurity( ushort newSecurityLevel);
  866.  
  867.                                  Called to update the current security level.  If the new
  868.                                  security level > fieldSecurity and the tfHideSecure is
  869.                                  enabled, then the field contents will be masked by the
  870.                                  securityChar character.  This routine is also called when
  871.                                  the cmUpdateSecurity broadcast is received.
  872.  
  873.                        setData   virtual void setData (void *rec);
  874.  
  875.                                  By default, copies the number of bytes (as returned by
  876.                                  dataSize) from the rec array to the data string, and then
  877.                                  calls selectAll(True). This zeros curPos, firstPos, and
  878.                                  selStart. Finally, drawView is called to redraw the input
  879.                                  box.
  880.  
  881.                                  Override setData if you define descendants to handle
  882.                                  non-string data types. You also use setData to convert
  883.                                  other data types to a string for editing by TField.
  884.  
  885.                                  See also: TField::dataSize, TField::getData,
  886.                                  TField::selectAll
  887.  
  888.                    setHideChar   virtual void setHideChar( char aChar );
  889.  
  890.                                  This routine is used to update the hideChar data member. 
  891.                                  If the new hideChar is > ' ' then the field's data will be
  892.                                  masked by the hideChar character.
  893.  
  894.                        setHint   virtual void setHint( char *aString );
  895.  
  896.                                  Sets this field's fieldHint string to aString.  The hint
  897.                                  options currently aren't implemented in this class.
  898.  
  899.                        setName   virtual void setName( char *aString );
  900.  
  901.                                  Sets this field's fieldName string to aString.
  902.  
  903.  
  904.  
  905.  
  906.  
  907.  
  908.  
  909.                   setTFOptions   virtual void setTFOptions (ushort aOption, Boolean enable);
  910.  
  911.                                  Called to change the state of various tfOption flags. 
  912.                                  tfOption flags control the justification, scrolling,
  913.                                  security, validation and enter handling for fields.
  914.  
  915.                                  See also: tfRight, tfNoScroll, tfHideSecure, tfValidateMax,
  916.                                  tfValidateMin, tfMustFill, tfNotEmpty, tfBeepError,
  917.                                  tfEnterTabs, tfStayError, tfPopUp and TField::tfOptions
  918.  
  919.                          valid   virtual void valid( ushort command );
  920.  
  921.                                  Called to validate the contents of the field.  If command =
  922.                                  cmValid, we're being called after the constructor.  If
  923.                                  command = cmArriving, we're being called before the field
  924.                                  is entered.  If command = cmLeaving, we're being called
  925.                                  before the field is left.  Currently performs standard
  926.                                  validations (ie. string length checks) when cmLeaving. 
  927.                                  Also calls the user supplies isValid function.
  928.  
  929.                          write   virtual void write( opstream& os);
  930.  
  931.                                  Writes to the output stream os.
  932.  
  933.                                  See also: TStreamableClass, TStreamable, opstream
  934.  
  935.             Related functions Certain operator functions are related to TField but are not
  936.             member functions; see page 232 for more information.
  937.  
  938.             Palette
  939.             TFields use the default palette, cpField, to map onto the 19th through 21st
  940.             entries in the standard dialog palette.
  941.  
  942.                          1     2     3     4
  943.                      ===========================
  944.             cpField  || x13 | x13 | x14 | x15 ||
  945.                      ===========================
  946.                Passive---^     |     |     ^---Arrow
  947.                Active-----------     ----------Selected
  948.  
  949.  
  950.  
  951.  
  952.  
  953.  
  954.  
  955.             TFloatField                                                 TFIELD.H tffield.cpp
  956.             --------------------------------------------------------------------------------
  957.                    __________
  958.                    | TField |
  959.                    ----------
  960.                        I
  961.                 _______I_______
  962.                 | TFloatField |
  963.                 ---------------
  964.  
  965.             TFloatField provides support for floating point numeric entries.  The current
  966.             implementation of TFloatField allows the +/- and PgUp/PgDn keys to
  967.             increment/decrement the value when the field is selected (selectAll( True )). 
  968.             This +/- will increment/decrement by a value of 1, the PgUp/PgDn by a value of
  969.             10.
  970.  
  971.                           Data
  972.                        members
  973.                                                                                             
  974.                          value   float value
  975.  
  976.                                  Holds the fields current value
  977.  
  978.                       maxValue   float maxValue
  979.  
  980.                                  Holds the maximum value to be checked if tfValidateMax is
  981.                                  set
  982.  
  983.                       minValue   float minValue
  984.  
  985.                                  Holds the minimum value to be checked if tfValidateMin is
  986.                                  set
  987.  
  988.  
  989.                         Member
  990.                      functions
  991.  
  992.             char *formatString; // field's format string for sprintf function call
  993.  
  994.  
  995.                    constructor   TFloatField( const TRect& bounds, int aMaxLen );
  996.  
  997.                                  Calls the TField constructor and initializes fieldType to
  998.                                  TFloatType.
  999.  
  1000.                     destructor   ~TFloatField();
  1001.  
  1002.                                  Release any storage allocated for the formatString.
  1003.  
  1004.  
  1005.  
  1006.  
  1007.  
  1008.  
  1009.  
  1010.                    convertData   virtual void convertData( void );
  1011.  
  1012.                                  Converts the string in data to a floating point value. 
  1013.                                  Calls sprintf to reformat the value back into data.  Uses
  1014.                                  formatString for the conversion if it is defined, otherwise
  1015.                                  uses the default %.2f for the conversion.
  1016.  
  1017.                       dataSize   virtual ushort dataSize();
  1018.  
  1019.                                  Returns sizeof(float);
  1020.  
  1021.                 filterCharCode   virtual ushort filterCharCode( ushort charCode );
  1022.  
  1023.                                  Filters out all characters except the digits, minus and
  1024.                                  decimal point.  If the entire field is selected, the +/-
  1025.                                  keys will increment/decrement the value by 1 respectively
  1026.                                  unless doing so would exceed a min/max boundary.
  1027.  
  1028.                 processKeycode   virtual ushort processKeyCode( ushort keyCode );
  1029.  
  1030.                                  If the entire field is selected, the kbPgUp/kbPgDn keys
  1031.                                  will add/subtract 10 from the current value unless doing so
  1032.                                  would exceed a min/max boundary.
  1033.  
  1034.                      setFormat   virtual void setFormat( char * newFormat );
  1035.  
  1036.                                  Specify a sprintf format string to be used to display the
  1037.                                  value.
  1038.  
  1039.                         setMax   virtual void setMax( float newMax );
  1040.  
  1041.                                  Sets maxValue to newMax and sets the tfValidateMax flag for
  1042.                                  the field.
  1043.  
  1044.                         setMin   virtual void setMin( float newMin );
  1045.  
  1046.                                  Sets minValue to newMin and sets the tfValidateMin flag for
  1047.                                  the field.
  1048.  
  1049.  
  1050.  
  1051.             TDoubleField                                               TFIELD.H tdbfield.cpp
  1052.             --------------------------------------------------------------------------------
  1053.                    __________
  1054.                    | TField |
  1055.                    ----------
  1056.                        I
  1057.                 _______I_______
  1058.                 | TDoubleField|
  1059.                 ---------------
  1060.  
  1061.             TDoubleField's functionality is currently the same as TFloatField's.  See the
  1062.             member functions of TFloatField for a description of the functionality. 
  1063.             TDoubleField does use double values instead of floats, though.
  1064.  
  1065.  
  1066.  
  1067.  
  1068.  
  1069.  
  1070.  
  1071.  
  1072.  
  1073.  
  1074.             TLongDoubleField                                           TFIELD.H tldfield.cpp
  1075.             --------------------------------------------------------------------------------
  1076.                    __________
  1077.                    | TField |
  1078.                    ----------
  1079.                        I
  1080.               _________I__________
  1081.               | TLongDoubleField |
  1082.               --------------------
  1083.  
  1084.             TLongDoubleField's functionality is currently the same as TFloatField's.  See
  1085.             the member functions of TFloatField for a description of the functionality. 
  1086.             TLongDoubleField uses long double values instead of floats.
  1087.  
  1088.  
  1089.  
  1090.  
  1091.             TIntField                                                   TFIELD.H tifield.cpp
  1092.             --------------------------------------------------------------------------------
  1093.                   __________
  1094.                   | TField |
  1095.                   ----------
  1096.                       I
  1097.                 ______I______
  1098.                 | TIntField |
  1099.                 -------------
  1100.  
  1101.             TIntField's functionality is almost exactly like TFloatField's.  The only
  1102.             significant different is filterCharCode does not allow decimals for TIntFields,
  1103.             TIntFields have no formatString and TIntField uses Int values instead of Floats.
  1104.  
  1105.  
  1106.  
  1107.  
  1108.             TLongField                                                  TFIELD.H tlfield.cpp
  1109.             --------------------------------------------------------------------------------
  1110.                   __________
  1111.                   | TField |
  1112.                   ----------
  1113.                       I
  1114.                 ______I_______
  1115.                 | TLongField |
  1116.                 --------------
  1117.  
  1118.             TLongField's functionality is almost exactly like TFloatField's.  The only
  1119.             significant different is filterCharCode does not allow decimals for TLongFields,
  1120.             TLongFields have not formatString and TLongField uses Long values instead of
  1121.             Floats.
  1122.  
  1123.  
  1124.  
  1125.  
  1126.  
  1127.  
  1128.  
  1129.             TParser                                                       TFIELD.H tdate.cpp
  1130.             --------------------------------------------------------------------------------
  1131.                 _____________________
  1132.                 | TStringCollection |
  1133.                 ---------------------
  1134.                          I
  1135.                     _____I_____
  1136.                     | TParser |
  1137.                     -----------
  1138.  
  1139.             TParser parses a character string, creating an unsorted TStringCollection of all
  1140.             the words/tokens contained in the string.
  1141.  
  1142.                         Member
  1143.                      Functions
  1144.  
  1145.                    Constructor   TParser( short aLimit, short aDelta )
  1146.  
  1147.                                  Calls the TStringCollection Constructor.
  1148.  
  1149.                        compare   virtual int compare(void *key1, void *key2)
  1150.  
  1151.                                  Returns a -1, causing strings to be added sequentially to
  1152.                                  the TStringCollection (duplicates are allowed.)
  1153.  
  1154.                          parse   void parse( char *line )
  1155.  
  1156.                                  Parses the line for words/tokens to add to the
  1157.                                  TStringCollection.  The characters /-. will be appended to
  1158.                                  the end of any word they follow, if no whitespace
  1159.                                  intervenes, otherwise they are added as seperate tokens.
  1160.              
  1161.  
  1162.  
  1163.  
  1164.  
  1165.  
  1166.  
  1167.  
  1168.             TUpperField                                                 TFIELD.H tufield.cpp
  1169.             --------------------------------------------------------------------------------
  1170.                 __________
  1171.                 | TField |
  1172.                 ----------
  1173.                     I
  1174.              _______I_______
  1175.              | TUpperField |
  1176.              ---------------
  1177.  
  1178.             TUpperField provides a version of TField which converts all lowercase characters
  1179.             to uppercase.
  1180.  
  1181.                         Member
  1182.                      functions
  1183.  
  1184.                    constructor   TUpperField(const TRect& bounds, int aMaxLen);
  1185.  
  1186.                                  Calls the TField constructor.
  1187.  
  1188.                 filterCharCode   virtual ushort filterCharCode( ushort charCode)
  1189.  
  1190.                                  Converts all lowercase characters to uppercase.
  1191.  
  1192.  
  1193.  
  1194.  
  1195.             TLowerField                                                TFIELD.H tlwfield.cpp
  1196.             --------------------------------------------------------------------------------
  1197.                 __________
  1198.                 | TField |
  1199.                 ----------
  1200.                     I
  1201.              _______I_______
  1202.              | TLowerField |
  1203.              ---------------
  1204.  
  1205.             TLowerField provides a version of TField which converts all uppercase characters
  1206.             to lowercase.
  1207.  
  1208.                         Member
  1209.                      functions
  1210.  
  1211.                    constructor   TLowerField(const TRect& bounds, int aMaxLen);
  1212.  
  1213.                                  Calls the TField constructor.
  1214.  
  1215.                 filterCharCode   virtual ushort filterCharCode( ushort charCode)
  1216.  
  1217.                                  Converts all uppercase characters to lowercase.
  1218.